#ifndef TAGWIDGET_H
#define TAGWIDGET_H

#include <QObject>
#include <QVariantMap>
#include "public/Public.h"
#include <QWidget>
/**
 * Runtag简化，在运行时传递数据
 * @brief The VarTag class
 */
struct VarTag {
    QString rtTagid = "0"; // 变量描述
    QString remark = ""; // 变量描述
    QString name = ""; // 变量名称
    QString unit = ""; // 变量单位
    QString value = "";
    QString varType = "STRING";  //变量应用类型，如Setting,Tag,Number等
    QString varFlag = "";
    QString initialValue = "";
    TTagDataType dataType = TYPE_VARIANT; // 变量的数据类型 如int ,float ,string
    TWriteAble writeable = CAN_WRITE; // 读写类型  0-只读, 1-可写

};

class TagWidget :public QWidget
{
    Q_OBJECT
    Q_PROPERTY(QVariantMap tags MEMBER m_tagMap)

public:
    QVariantMap m_tagMap;
    QVariantMap m_varMap;
public:
    explicit TagWidget(QWidget *parent);
    void setTags(QVariantMap tagMap);
    void setTag(QString tagKey,VarTag varTag);
    QVariantMap getTags();
    void addTag(VarTag varTag);
    VarTag getTag(QString tagKey);

signals:
    void onTagChanged(VarTag tagVar);
};

#endif // TAGWIDGET_H
